<%@page pageEncoding="utf-8" contentType="text/html; charset=utf-8"%>
<%@taglib prefix="s" uri="strutsTags"%>
<%
	String path = request.getContextPath();
	String basePath = request.getScheme() + "://"
			+ request.getServerName() + ":" + request.getServerPort()
			+ path + "/";
%>
<html>
	<base href="<%=basePath%>">
	<head>
		<title>新增员工社保记录</title>
	</head>
	<body>
		<s:component template="bodyhead">
			<s:param name="pagetitle" value="'新增社保记录'" />
		</s:component>
		<span class="errorMessage" id="message"></span>
		<form id="addBenefitForm" name="addBenefitForm" method="post"
			action="compensation/addBenefit.action">

			<input type="hidden" id="employeeId" name="employeeId"
				value="<s:property value='emp.id'/>">
			<input type="hidden" id="hiddenempLocationNo"
				name="employee.empLocationNo.id"
				value="<s:property value='employee.empLocationNo.id'/>">
			<input type="hidden" id="hiddenedepartmentNo"
				name="employee.empDeptNo.id"
				value="<s:property value='employee.empDeptNo.id'/>">
			<input type="hidden" id="hiddenempIdentificationNo"
				name="employee.empIdentificationNo"
				value="<s:property value='employee.empIdentificationNo'/>">
			<input type="hidden" id="hiddenempStatus" name="employee.empStatus"
				value="<s:property value='employee.empStatus'/>">
			<input type="hidden" id="hiddenempBenefitTypeAdv"
				name="employee.empBenefitType.id"
				value="<s:property value='employee.empBenefitType.id'/>">
			<input type="hidden" id="empNameOrDist" name="empNameOrDist"
				value="<s:property value='empNameOrDist'/>">
			<table width="100%" class="formtable" id="employeeTable">
				<tr>
					<s:textfield id="emp.empDistinctNo" name="emp.empDistinctNo"
						label="员工编号" readonly="true" cssClass="nothinginput" />
					<s:textfield id="emp.empJoinDate" name="emp.empJoinDate"
						label="入职日期" readonly="true" cssClass="nothinginput" />
					<s:if test="emp.empStatus==1">
						<s:textfield id="empStatus" name="empStatus" label="员工状态"
							value="在职" readonly="true" cssClass="nothinginput" />
					</s:if>
					<s:elseif test="emp.empStatus==0">
						<s:textfield id="empStatus" name="empStatus" label="员工状态"
							value="离职" readonly="true" cssClass="nothinginput" />
					</s:elseif>
				</tr>
				<tr>
					<s:textfield id="emp.empName" name="emp.empName" label="员工姓名"
						readonly="true" cssClass="nothinginput" />
					<s:textfield id="emp.empIdentificationNo"
						name="emp.empIdentificationNo" label="身份证件" readonly="true"
						cssClass="nothinginput" />
					<s:textfield id="emp.empType.emptypeName"
						name="emp.empType.emptypeName" label="用工形式" readonly="true"
						cssClass="nothinginput" />
				</tr>
				<tr>
					<s:textfield id="emp.empDeptNo.departmentName"
						name="emp.empDeptNo.departmentName" label="所属部门" readonly="true"
						cssClass="nothinginput" />
					<s:textfield id="emp.empPbNo.pbName" name="emp.empPbNo.pbName"
						label="当前职位" readonly="true" cssClass="nothinginput" />
					<s:textfield id="emp.empLocationNo.locationName"
						name="emp.empLocationNo.locationName" label="工作地区" readonly="true"
						cssClass="nothinginput" />
				</tr>
				<tr>
					<td>
						&nbsp;
					</td>
				</tr>
				<tr>
					<s:select label="社保种类" id="empBenefitType"
						name="emp.empBenefitType.id" list="ebfTypeList" listKey="id"
						listValue="benefitTypeName" multiple="false" emptyOption="true"
						value="emp.empBenefitType.id" />
					<td align="right">
						生效年月:
					</td>
					<td>
						<s:select id="startBtfYear" name="startBtfYear" list="yearList"
							emptyOption="false" />
						<s:select id="startBtfMonth" name="startBtfMonth"
							list="#{'01':'01','02':'02','03':'03','04':'04','05':'05','06':'06','07':'07','08':'08','09':'09','10':'10','11':'11','12':'12'}"
							emptyOption="false" />
						<s:hidden id="ebfStartMonth" name="emp.benefit.ebfStartMonth" />
					</td>
				</tr>
				<tr>
					<s:textfield label="养老保险号" id="emp.benefit.ebfPensionNo"
						name="emp.benefit.ebfPensionNo" size="16" maxlength="64"
						onkeyup="value=value.replace( /[^0-9a-zA-Z]/g,'');"
						onkeypress="HRMCommon.MKeyTextLength(this,64);" />
					<s:textfield label="公积金号" id="emp.benefit.ebfHousingNo"
						name="emp.benefit.ebfHousingNo" size="16" maxlength="64"
						onkeyup="value=value.replace( /[^0-9a-zA-Z]/g,'');"
						onkeypress="HRMCommon.MKeyTextLength(this,64);" />
					<s:textfield label="医疗保险号" id="emp.benefit.ebfMedicalNo"
						name="emp.benefit.ebfMedicalNo" size="16" maxlength="64"
						onkeyup="value=value.replace( /[^0-9a-zA-Z]/g,'');"
						onkeypress="HRMCommon.MKeyTextLength(this,64);" />
				</tr>
				<tr>
					<s:textfield label="社保基数(D2)" id="ebfPensionAmount"
						name="emp.benefit.ebfPensionAmount" size="16" maxlength="64"
						onkeypress="HRMCommon.checkOnKeyDownFloat(event,this)"
						onblur="HRMCommon.checkFloatAndFormat(this);" />
					<s:textfield label="公积金基数(D3)" id="ebfHousingAmount"
						name="emp.benefit.ebfHousingAmount" size="16" maxlength="64"
						onkeypress="HRMCommon.checkOnKeyDownFloat(event,this)"
						onblur="HRMCommon.checkFloatAndFormat(this);" />
					<s:textfield label="综合保险基数(D4)" id="ebfInsuranceAmount"
						name="emp.benefit.ebfInsuranceAmount" size="16" maxlength="64"
						onkeypress="HRMCommon.checkOnKeyDownFloat(event,this)"
						onblur="HRMCommon.checkFloatAndFormat(this);" />
				</tr>
				<tr>
					<td colspan="7" align="left">
						<font color="red">&nbsp;&nbsp;备注：D2、D3、D4表示薪资帐套中对应的变量引用名称。</font>
					</td>
				</tr>
				<tr>
					<td colspan="7" class="prompt_div_bottom">
						<input id="doaction" class="button" type="submit" name="okbtn"
							onclick="return reCheck();" value="确定">
						<input class="button" type="button" name="back"
							onclick="if(confirm('您确定要取消本次操作吗？')) retSearchebf();" value="取消" />
					</td>
				</tr>
			</table>
		</form>

		<script type="text/javascript" language="javascript">
	//action跳转到查询社保页面
	function retSearchebf() {
		var url = "searchEmpbenefit.action";
		document.addBenefitForm.action = url;
		document.addBenefitForm.submit();
	}

	function reCheck() {
		if ($('#empBenefitType').val() == '') {
			alert("社保种类不能为空！");
			return false;
		}
		if ($('#ebfPensionAmount').val() == ''
				&& $('#ebfHousingAmount').val() == ''
				&& $('#ebfInsuranceAmount').val() == '') {
			alert("请填写至少一项基数！");
			return false;
		}

		var yearmonth = $('#startBtfYear').val() + $('#startBtfMonth').val();
		$('#ebfStartMonth').val(yearmonth);
		return true;
	}
</script>
	</body>
</html>
